#include "Globals.h"

  extern long lx            = 0;
  extern long ly            = 0;
  extern long low1          = 0;
  extern long low2          = 0;

  extern WORD y             = 0;
  extern WORD x             = 0;
  extern WORD cur_node      = 0;
  extern WORD list_ptr      = 0;
  extern WORD init_y        = 0;
  extern WORD node1         = 0;
  extern WORD node2         = 0;
  extern WORD snode         = 0;
  extern WORD bpos          = 0;

 // Used to store the bit codes per value
  extern char htbl[256][32] = { 0 };

  extern HNODE huf[256]     = { 0 };
  extern HNODE temp         = { 0 };

  extern FILE *f1           = { 0 };
  extern FILE *f2           = { 0 };
  extern FILE *f3           = { 0 };
  extern FILE *mf           = { 0 };

  extern char fil1[260]     = { 0 }; // input file
  extern char fil2[260]     = { 0 }; // output file
  extern char fil3[260]     = { 0 }; // bit mapping file
  extern char buffer[260]   = { 0 };
  extern char ptr[256]      = { 0 };

  extern int  c             = 0;
  extern int  t             = 0;

  extern BYTE data          = 0;

////////////////////////////////////
//                                //
////////////////////////////////////
long FileLen ( FILE *tf )
{
  long val;

  if ( !tf ) return -1;
  fseek(tf,0,SEEK_END);
  val = ftell(tf);
  fseek(tf,0,SEEK_SET);

  return val;
}

///////////////////////////////////
//                               //
///////////////////////////////////
void strchg( char *buf, char c1, char c2)
{
  int  c = -1;

  while( ++c < strlen(buf) )
    if ( buf[c] == c1 ) buf[c] = c2;
}


///////////////////////////////////
//                               //
///////////////////////////////////
BYTE UpperCase( char *buf )
{
  if ( !buf ) return 1;
  for ( int c = 0; c < strlen(buf); c++ )
    buf[c] = toupper(buf[c]);

  return 0;
}

